<template>
  <div>
    <el-button type="primary" class="add" @click="addGrade()">+新增薪级</el-button>
    
    <el-table :data="grades">
      <el-table-column
        prop="gradeCode"
        label="岗位分类"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="gradeName"
        label="岗位类别/职称类别"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="sort"
        label="薪级"
        align="center"
      ></el-table-column>
      <el-table-column label="操作" prop="createTime" align="center">
        <template slot-scope="scope">
          <span class="org-oper">
            <el-button
              size="mini"
              type="primary"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['organization:grade:edit']"
              >修改</el-button
            >
          </span>
        </template>
      </el-table-column>
    </el-table>
    <add-grade
    v-if="dialogForm"
    :dialogForm="dialogForm"
    @close="closeDialog"
    ></add-grade>
  </div>
</template>

<script>
import addGrade from './addGrade.vue'
export default {
  name: "salaryGradeDispose",
  components:{addGrade},
  data() {
    return {
      dialogForm:false,
          tableData: [
        {
          id: "12987122",
          name: "王小虎",
          amount1: "234",
          amount2: "3.2",
          amount3: 10,
        },
        {
          id: "12987122",
          name: "王小虎",
          amount1: "234",
          amount2: "3.2",
          amount3: 10,
        },
        {
          id: "12987122",
          name: "王小虎",
          amount1: "234",
          amount2: "3.2",
          amount3: 10,
        },
      ],
      queryParams: {
        employeeCode: null,
        employeeName: null,
        employeeTel: null,
        employeeJoinStatus: null,
        employeeFormalStatus: null,
        employeeLeaveStatus: null,
        employeeRetiredStatus: null,
        current: 1, //当前页码
        size: 10, //每页显示数量
      },
      grades: [
        {
          gradeCode: "教学类",
          gradeName: "教学单位正职",
          sort: "P1、P2",
        },
        {
          gradeCode: "管理类",
          gradeName: "教授",
          sort: "P1、P2、P3",
        },
      ],
    };
  },
    methods: {
    handleClick(tab, event) {
      let name = tab.name;
      switch (name) {
        case "holdPost":
          this.queryParams.employeeStatus = "2";
          this.tableCols = [
            {
              prop: "employeeName",
              label: "中文姓名",
              show: true,
              disable: false,
            },
            { prop: "employeeCode", label: "工号", show: true, disable: false },
            {
              prop: "employeeStatus",
              label: "转正状态",
              show: true,
              disable: false,
            },
            { prop: "postName", label: "岗位名称", show: true, disable: false },
            {
              prop: "postTypeName",
              label: "岗位类别",
              show: true,
              disable: false,
            },
            {
              prop: "gradeName",
              label: "岗位职级",
              show: true,
              disable: false,
            },
            {
              prop: "organizationName",
              label: "直属组织",
              show: true,
              disable: false,
            },
            {
              prop: "employeeEmployType",
              label: "雇佣性质",
              show: true,
              disable: false,
            },
            {
              prop: "employeeInHeadship",
              label: "编制类型",
              show: true,
              disable: false,
            },
            {
              prop: "employeeGender",
              label: "性别",
              show: true,
              disable: false,
            },
            { prop: "age", label: "年龄", show: true, disable: false },
            {
              prop: "employeeTel",
              label: "手机号",
              show: true,
              disable: false,
            },
          ];
          break;
        case "leave":
          this.queryParams.employeeStatus = "3";
          this.tableCols = [
            {
              prop: "employeeName",
              label: "中文姓名",
              show: true,
              disable: false,
            },
            { prop: "employeeCode", label: "工号", show: true, disable: false },
            { prop: "postName", label: "岗位名称", show: true, disable: false },
            {
              prop: "postTypeName",
              label: "岗位类别",
              show: true,
              disable: false,
            },
            {
              prop: "gradeName",
              label: "岗位职级",
              show: true,
              disable: false,
            },
            {
              prop: "organizationName",
              label: "直属组织",
              show: true,
              disable: false,
            },
            {
              prop: "employeeEmployType",
              label: "雇佣性质",
              show: true,
              disable: false,
            },
            {
              prop: "employeeInHeadship",
              label: "编制类型",
              show: true,
              disable: false,
            },
            {
              prop: "employeeGender",
              label: "性别",
              show: true,
              disable: false,
            },
            { prop: "age", label: "年龄", show: true, disable: false },
            {
              prop: "employeeJoinTime",
              label: "入职日期",
              show: true,
              disable: false,
            },
            {
              prop: "employeeLeaveTime",
              label: "离职日期",
              show: true,
              disable: false,
            },
            {
              prop: "employeeLeaveType",
              label: "离职类型",
              show: true,
              disable: false,
            },
          ];
          break;
        case "retired":
          this.queryParams.employeeStatus = "4";
          this.tableCols = [
            {
              prop: "employeeName",
              label: "中文姓名",
              show: true,
              disable: false,
            },
            { prop: "employeeCode", label: "工号", show: true, disable: false },
            { prop: "postName", label: "岗位名称", show: true, disable: false },
            {
              prop: "postTypeName",
              label: "岗位类别",
              show: true,
              disable: false,
            },
            {
              prop: "gradeName",
              label: "岗位职级",
              show: true,
              disable: false,
            },
            {
              prop: "organizationName",
              label: "直属组织",
              show: true,
              disable: false,
            },
            {
              prop: "employeeEmployType",
              label: "雇佣性质",
              show: true,
              disable: false,
            },
            {
              prop: "employeeInHeadship",
              label: "编制类型",
              show: true,
              disable: false,
            },
            {
              prop: "employeeGender",
              label: "性别",
              show: true,
              disable: false,
            },
            { prop: "age", label: "年龄", show: true, disable: false },
            {
              prop: "employeeJoinTime",
              label: "入职日期",
              show: true,
              disable: false,
            },
            {
              prop: "employeePlanLeaveTime",
              label: "计退休日期",
              show: true,
              disable: false,
            },
            {
              prop: "employeeRetiredTime",
              label: "办理日期",
              show: true,
              disable: false,
            },
          ];
          break;
        default:
          this.queryParams.employeeStatus = "2";
          this.tableCols = [
            {
              prop: "employeeName",
              label: "中文姓名",
              show: true,
              disable: false,
            },
            { prop: "employeeCode", label: "工号", show: true, disable: false },
            {
              prop: "employeeStatus",
              label: "转正状态",
              show: true,
              disable: false,
            },
            { prop: "postName", label: "岗位名称", show: true, disable: false },
            {
              prop: "postTypeName",
              label: "岗位类别",
              show: true,
              disable: false,
            },
            {
              prop: "gradeName",
              label: "岗位职级",
              show: true,
              disable: false,
            },
            {
              prop: "organizationName",
              label: "直属组织",
              show: true,
              disable: false,
            },
            {
              prop: "employeeEmployType",
              label: "雇佣性质",
              show: true,
              disable: false,
            },
            {
              prop: "employeeInHeadship",
              label: "编制类型",
              show: true,
              disable: false,
            },
            {
              prop: "employeeGender",
              label: "性别",
              show: true,
              disable: false,
            },
            { prop: "age", label: "年龄", show: true, disable: false },
            {
              prop: "employeeTel",
              label: "手机号",
              show: true,
              disable: false,
            },
          ];
          break;
      }
      this.getPageList();
    },
    clickReset() {
      this.reset = !this.reset;
    },
    resetQuery() {
      this.queryParams = {
        employeeCode: null,
        employeeName: null,
        employeeTel: null,
        employeeStatus: "2",
        size: 10,
        current: 1,
      };
      this.getPageList();
    },
    // 翻页
    handleCurrentChange(val) {
      this.queryParams.current = val;
      this.getPageList();
    },
    addGrade(){
      this.dialogForm=true;
    },
    //修改
    handleUpdate(row){
      this.dialogForm=true;
    },
    closeDialog(params){
      this.dialogForm=params
    }
  },
};
</script>

<style lang="scss" scoped>
.el-table {
  margin-top: 20px;
}
.el-tabs {
  margin: 0 20px;
}
.el-tabs__item {
  font-size: 16px;
  font-weight: bold;
}
.el-dropdown-link {
  cursor: pointer;
  color: #409eff;
}
.el-icon-arrow-down {
  font-size: 12px;
}
.add{
    float: right;
    margin: 20px;
}
</style>

